#ifndef FOCUS_SERVER_H_
#define FOCUS_SERVER_H_

/**
 * Class used by the gui subsystem in order to determine which
 * component gets focused after a keyboard or mouse event occurrs.
 */

class MouseEvent;

namespace gui
{
    
class Component;
class Container;

class FocusServer
{
private:
    Component *m_lastFocused;
    
public:
    
    FocusServer();
    
    
    ~FocusServer();
    
    
    /**
     * Resolves which component is focused after a mouse event and returns it.
     * 
     * @param event: the mouse event occurred.
     * @param root: root container that we want to check its structure for focus.
     * @return a handle to the focused component.
     */
    
    Component* ResolveMouseFocus(const MouseEvent& event, gui::Container *root);
    
    
    /**
     * @return a handle to the component that was focused last.
     */
    
    Component* GetLastFocused();
};

};

#endif